package zero.tech.games.phz.process;

import java.util.ArrayList;
import java.util.List;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import zero.tech.core.ZeroContext;
import zero.tech.core.data.Resp;
import zero.tech.games.logic.common.Room;
import zero.tech.games.logic.process.ReqRoomProcess;
import zero.tech.games.phz.data.consts.PHZCMD;
import zero.tech.games.phz.service.api.IPhzService;
import zero.tech.wsnet.controller.LogicController;
import zero.tech.wsnet.data.IREQ;
@IREQ(code = PHZCMD.REQ_SETCARDS)
public class ReqSetcards extends ReqRoomProcess{

	@Override
	public void process(Room room, LogicController controller, Resp param) {
		IPhzService pdkService=ZeroContext.getInstance(IPhzService.class);
		JSONObject obj = (JSONObject) param.getParam();
		JSONArray array=obj.getJSONArray("cards");
		int size=array.size();
		List<Integer> cardIds=new ArrayList<Integer>();
		for(int i=0;i<size;i++) {
			int cardId=array.getIntValue(i);
			cardIds.add(cardId);
		}
		pdkService.reqSetcards(room, controller,cardIds);
	}

}
